import * as api from '../../api/head';
import { Dispatch, AnyAction } from 'redux';

export function getHeadAction (params: any) {

  return function (dispatch: Dispatch<AnyAction>) {
    return api.getHeadData(params.username)
      .then(
        res => dispatch({
          type: 'UPDATE',
          value: res.data.result,
        }),
        err => {
          console.dir(err)
          dispatch({
            type: 'ERROR',
          })
        },
      );
  }
}
